/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.zx.user.vip.entity;

import com.jeesite.common.entity.BaseEntity;
import com.jeesite.common.entity.Extend;
import com.jeesite.modules.zx.user.entity.ZxUser;
import org.hibernate.validator.constraints.Length;
import java.util.Date;

import javax.validation.Valid;

import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.common.utils.excel.annotation.ExcelField;
import com.jeesite.common.utils.excel.annotation.ExcelFields;
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;

/**
 * 用户会员管理Entity
 * @author zpp
 * @version 2020-03-22
 */
@Table(name="t_user_vip", alias="a", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="user_id", attrName="userId", label="user_id"),
		@Column(name="vip_starttime", attrName="vipStarttime", label="会员有效期的开始时间"),
		@Column(name="vip_endtime", attrName="vipEndtime", label="会员有效期的结束时间"),
},joinTable={
		@JoinTable(type=Type.LEFT_JOIN, entity= ZxUser.class, alias="zu",
				on="zu.user_code = a.user_id", attrName="zxuser",
				columns={
						@Column(name="user_code", attrName="userCode", label="用户编码", isPK=true),
						@Column(name="login_code", attrName="loginCode", label="登录账号"),
						@Column(name="user_name", attrName="userName", label="用户昵称", queryType=QueryType.LIKE),
						@Column(name="password", attrName="password", label="登录密码"),
						@Column(name="email", attrName="email", label="电子邮箱"),
						@Column(name="mobile", attrName="mobile", label="手机号码"),
						@Column(name="phone", attrName="phone", label="办公电话"),
						@Column(includeEntity=DataEntity.class),
						@Column(includeEntity= BaseEntity.class),
						@Column(includeEntity= Extend.class, attrName="extend"),
						@Column(name="identity", attrName="identity", label="身份标识", comment="身份标识(student,teacher)"),
						@Column(name="accept", attrName="accept", label="是否同意条款 0代表不同意 1表示同意"),
						@Column(name="introduce",attrName="introduce",label="用户介绍",comment="用户介绍"),
				})},
		orderBy="a.id DESC"
)
public class TuserVip extends DataEntity<TuserVip> {

	private static final long serialVersionUID = 1L;
	private String userId;		// user_id
	private String userName,mobile;
	private Date vipStarttime;		// 会员有效期的开始时间
	private Date vipEndtime;		// 会员有效期的结束时间

	private ZxUser zxuser;
	@Override
	@Valid
	@ExcelFields({
		    @ExcelField(title="姓名", attrName="userName", align=Align.CENTER, sort=10,type=ExcelField.Type.EXPORT),
			@ExcelField(title="手机号", attrName="mobile", align=Align.CENTER, sort=30),
			@ExcelField(title="会员有效期的开始时间", attrName="vipStarttime", align=Align.CENTER, sort=40),
			@ExcelField(title="会员有效期的结束时间", attrName="vipEndtime", align=Align.CENTER, sort=50),
	})
	public String getId() {
		return super.getId();
	}
	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public TuserVip() {
		this(null);
	}

	public TuserVip(String id){
		super(id);
	}

	@Length(min=0, max=50, message="user_id长度不能超过 50 个字符")
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getVipStarttime() {
		return vipStarttime;
	}

	public void setVipStarttime(Date vipStarttime) {
		this.vipStarttime = vipStarttime;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getVipEndtime() {
		return vipEndtime;
	}

	public void setVipEndtime(Date vipEndtime) {
		this.vipEndtime = vipEndtime;
	}

	public ZxUser getZxuser() {
		return zxuser;
	}

	public void setZxuser(ZxUser zxuser) {
		this.zxuser = zxuser;
	}
}